package com.example.dessert.config;

import com.example.dessert.util.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName: LoginConfig
 * @Description: 拦截器配置
 * @Author li
 * @Date 2022/1/11
 * @Version 1.0
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {
    @Bean
    public LoginInterceptor loginInterceptor() {
        return new LoginInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/fore/css/*",
                        "/fore/js/*",
                        "/fore/images/*"
                );
    }
}

